_globals["servertime"] = 0;
_globals["time_left"] = 0;
_globals["time_left_rpc"] = 0;


_globals["server_time"] = 0;
_globals["server_time_diff"] = 0;
_globals["time_seconds"] = 0;
function Main_timer()
{
    var today = new Date();

    _globals["time_left"] ++;
    _globals["time_left_rpc"] ++;
    show_time();
}

function SyncServer(time)
{
     _globals["server_time"] = time-0;
     // замеряем текущее время
     var today = new Date();
     browser_time = today.getTime();
     browser_time = Math.ceil(browser_time / 1000)
     _globals["server_time_diff"] = _globals["server_time"] - browser_time;
}

_globals["time_div"] = false;
function show_time()
{
    var today = new Date();
    normal_time = Math.ceil(today.getTime()/1000)+_globals["server_time_diff"]-0;
    today = new Date((normal_time-0) * 1000);
    _globals["time_seconds"] = normal_time;
    var clock_status=today.getHours()+":"+today.getMinutes()+":"+today.getSeconds();
    if(_globals["time_div"] == false)
    {
        _globals["time_div"] = _new('DIV');
        _globals["time_div"].id = 'time_div';
        document.body.appendChild(_globals["time_div"])
    }

    _globals["time_div"].innerHTML = clock_status;
}
